package com.yilin.tms.core.entity.data.invoice;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yilin.tms.core.commons.base.BaseDataEntity;
import com.yilin.tms.core.entity.order.transit.TransitOrder;
import com.yilin.tms.core.entity.user.account.Account;
import com.yilin.tms.core.entity.user.organize.Organize;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 * 客户（货主）发票
 *
 * @author zhangjinyuan
 * @date 2022/9/6
 */
@Entity
@Table(name = "data_custom_invoice")
@TableName("data_custom_invoice")
public class CustomInvoice extends BaseDataEntity {
    public enum InvoiceState {
        apply(0, "申请中"),
        cancel(1, "取消申请"),
        locking(2, "锁定中"),
        success(3, "开票成功"),
        fail(4, "开票失败"),
        redFlush(5, "冲红");

        @EnumValue
        public Integer index;
        public String name;

        InvoiceState(Integer index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    /**
     * 基础信息
     */
    //组织IDId
    @Column(name = "organize_id")
    private String organizeId;
    //运单Id 多个运单","隔开
    @Column(name = "order_id")
    private String orderId;
    //发票号
    @Column(name = "invoice_no")
    private String invoiceNo;
    //发票状态
    @Column(name = "invoice_state")
    private InvoiceState invoiceState;
    //发票金额
    @Column(name = "invoice_amount")
    private String invoiceAmount;

    /**
     * 抬头信息
     */
    //发票抬头ID
    @Column(name = "title_id")
    private String titleId;
    //抬头类型
    @Column(name = "title_type")
    private InvoiceHeader.HeaderType titleType;
    //发票抬头名称(公司名称/个人名字)
    @Column(name = "invoice_title")
    private String invoiceTitle;
    //公司税号
    @Column(name = "vat_company_name")
    private String vatCompanyName;
    //公司地址
    @Column(name = "vat_company_address")
    private String vatCompanyAddress;
    //联系电话
    @Column(name = "vat_tel_phone")
    private String vatTelPhone;
    //开户银行
    @Column(name = "vat_bank_name")
    private String vatBankName;
    //银行帐号
    @Column(name = "vat_bank_account")
    private String vatBankAccount;

    /**
     * 开票完成
     */
    //开票时间
    @Column(name = "complete_time")
    private Date completeTime;
    //发票图片 多张图片","隔开
    @Column(name = "invoice_url", columnDefinition = "TEXT")
    private String invoiceUrl;
    //失败原因
    @Column(name = "fail_reason")
    private String failReason;

    /**
     * 冲红
     */
    //冲红原因
    @Column(name = "red_flush_reason")
    private String redFlushReason;
    //冲红时间
    @Column(name = "red_flush_time")
    private Date redFlushTime;
    //处理人
    @Column(name = "deal_user_id")
    private String dealUserId;
    //处理人名称
    @Column(name = "deal_user_name")
    private String dealUserName;
    /**
     * 查询字段
     */
    //货主信息
    @Transient
    @TableField(exist = false)
    private Organize organize;
    //发票关联运单
    @Transient
    @TableField(exist = false)
    private List<TransitOrder> transitOrderList;


    public String getOrganizeId() {
        return organizeId;
    }

    public void setOrganizeId(String organizeId) {
        this.organizeId = organizeId;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public InvoiceState getInvoiceState() {
        return invoiceState;
    }

    public void setInvoiceState(InvoiceState invoiceState) {
        this.invoiceState = invoiceState;
    }

    public String getInvoiceAmount() {
        return invoiceAmount;
    }

    public void setInvoiceAmount(String invoiceAmount) {
        this.invoiceAmount = invoiceAmount;
    }

    public String getTitleId() {
        return titleId;
    }

    public void setTitleId(String titleId) {
        this.titleId = titleId;
    }

    public InvoiceHeader.HeaderType getTitleType() {
        return titleType;
    }

    public void setTitleType(InvoiceHeader.HeaderType titleType) {
        this.titleType = titleType;
    }

    public String getInvoiceTitle() {
        return invoiceTitle;
    }

    public void setInvoiceTitle(String invoiceTitle) {
        this.invoiceTitle = invoiceTitle;
    }

    public String getVatCompanyName() {
        return vatCompanyName;
    }

    public void setVatCompanyName(String vatCompanyName) {
        this.vatCompanyName = vatCompanyName;
    }

    public String getVatCompanyAddress() {
        return vatCompanyAddress;
    }

    public void setVatCompanyAddress(String vatCompanyAddress) {
        this.vatCompanyAddress = vatCompanyAddress;
    }

    public String getVatTelPhone() {
        return vatTelPhone;
    }

    public void setVatTelPhone(String vatTelPhone) {
        this.vatTelPhone = vatTelPhone;
    }

    public String getVatBankName() {
        return vatBankName;
    }

    public void setVatBankName(String vatBankName) {
        this.vatBankName = vatBankName;
    }

    public String getVatBankAccount() {
        return vatBankAccount;
    }

    public void setVatBankAccount(String vatBankAccount) {
        this.vatBankAccount = vatBankAccount;
    }

    public Date getCompleteTime() {
        return completeTime;
    }

    public void setCompleteTime(Date completeTime) {
        this.completeTime = completeTime;
    }

    public String getInvoiceUrl() {
        return invoiceUrl;
    }

    public void setInvoiceUrl(String invoiceUrl) {
        this.invoiceUrl = invoiceUrl;
    }

    public String getFailReason() {
        return failReason;
    }

    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }

    public String getRedFlushReason() {
        return redFlushReason;
    }

    public void setRedFlushReason(String redFlushReason) {
        this.redFlushReason = redFlushReason;
    }

    public Date getRedFlushTime() {
        return redFlushTime;
    }

    public void setRedFlushTime(Date redFlushTime) {
        this.redFlushTime = redFlushTime;
    }

    public Organize getOrganize() {
        return organize;
    }

    public void setOrganize(Organize organize) {
        this.organize = organize;
    }

    public String getDealUserId() {
        return dealUserId;
    }

    public void setDealUserId(String dealUserId) {
        this.dealUserId = dealUserId;
    }

    public String getDealUserName() {
        return dealUserName;
    }

    public void setDealUserName(String dealUserName) {
        this.dealUserName = dealUserName;
    }

    public List<TransitOrder> getTransitOrderList() {
        return transitOrderList;
    }

    public void setTransitOrderList(List<TransitOrder> transitOrderList) {
        this.transitOrderList = transitOrderList;
    }
}
